package com.riwon.im.common.constant;

/**
 * @author wpy
 * @date 2018/5/10 14:44
 */
public class MsgConstant {

    public enum MsgType{
        USER(1,"文本"),
        MEMBER(2,"图片"),
        ;

        private int code;
        private String dsc;

        MsgType(int code, String dsc) {
            this.code = code;
            this.dsc = dsc;
        }

        public int getCode() {
            return code;
        }

        public String getDsc() {
            return dsc;
        }

        public static MsgType getByCode(Integer code){
            for (MsgType type : MsgType.values()) {
                if(type.getCode() == code){
                    return type;
                }
            }
            return null;
        }
    }

    public enum MsgState{
        NOT_SEND(0,"未发送"),
        SENT(1,"已发送"),
        READ(2,"已读"),
        ;

        private int code;
        private String dsc;

        MsgState(int code, String dsc) {
            this.code = code;
            this.dsc = dsc;
        }

        public int getCode() {
            return code;
        }

        public String getDsc() {
            return dsc;
        }

        public static MsgState getByCode(Integer code){
            for (MsgState type : MsgState.values()) {
                if(type.getCode() == code){
                    return type;
                }
            }
            return null;
        }
    }
}
